package org.app.test.gc;

import org.junit.Test;

import junit.framework.TestCase;

/**
-Xms1024m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+PrintGCDetails -server

 */
public class testgc extends TestCase {
	@Test
	public void testgc() {
		Object referent = new Object();

		/**
		 * 通过赋值创建 StrongReference
		 */
		Object strongReference = referent;

		assertSame(referent, strongReference);
		// assertSame("111", "1121");

		referent = null;
		System.gc();

		/**
		 * StrongReference 在 GC 后不会被回收
		 */
		assertNotNull(strongReference);
		assertNotNull("11");
	}

}
